﻿'Description:报工类接口
'Copyright (c) : 通力凯顿（北京）系统集成有限公司
'Writer:Yangsj
'create Date:2017-5-08
'Rewriter:
'Rewrite Date:
Imports BusinessRule.DTO
Imports System.Text

Public Interface uLMSWorkReportIBusiness

    'Add by Yuxj20200429
    Function GetUserAllWorkTime(ByVal para As Dictionary(Of String, String)) As Double

    ''' <summary>
    '''  添加生产报工 vuale="split" 则添加的报工信息不再处理
    ''' create tianFW
    ''' </summary>
    ''' <param name="entity"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function AddContainerStepWorkReportInfo(ByVal entity As ContainerStepWorkReportDTO, ByVal value As String) As Boolean
    Function FillContainerStepWorkReportInfoTrans(ByVal entity As ContainerStepWorkReportDTO, ByVal value As String) As Object()

    ''' <summary>
    ''' 按唯一ID删除生产报工
    ''' create tianFW
    ''' </summary>
    ''' <param name="ContainerStepWorkReportID"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function DelContainerStepWorkReportInfoBycswrid(ByVal ContainerStepWorkReportID As String) As Boolean

    ''' <summary>
    ''' 添加生产报工子序号
    ''' create tianFW
    ''' </summary>
    ''' <param name="entity"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function AddContainerStepWorkReportChildInfo(ByVal entity As ContainerStepWorkReportChildDTO) As Boolean
    Function FillContainerStepWorkReportChildInfo(ByVal entity As ContainerStepWorkReportChildDTO) As Object()
    ''' <summary>
    ''' 按唯一ID删除生产报工子序号
    ''' create tianFW
    ''' </summary>
    ''' <param name="ContainerStepWorkReportID"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function DelContainerStepWorkReportChildInfoByccid(ByVal ContainerStepWorkReportID As String) As Boolean

    ''' <summary>
    ''' 获取报工信息
    ''' create tianFW
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetStepReportInfo(ByVal para As Dictionary(Of String, String), ByRef sbCondition As StringBuilder) As uMESProcessResult

    ''' <summary>
    ''' 获取单件单卡报工明细信息 create by tianFW 2018年11月19日
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetStepWorkReportDetailInfo(ByVal para As Dictionary(Of String, String)) As DataTable

    ''' <summary>
    ''' 接收任务
    ''' create tianFW
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function ReceviceDispatch(ByVal para As Dictionary(Of String, String)) As Integer
    Function FillReceviceDispatch(ByVal para As Dictionary(Of String, String)) As Object()
    ''' <summary>
    ''' 查询派工单和报工单数据信息
    ''' Create tianFW
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetDispatchInfoToReport(ByVal para As Dictionary(Of String, String)) As DataTable

    ''' <summary>
    ''' 获取报工人信息
    ''' Create tianFW
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetWorkerInfo(ByVal para As Dictionary(Of String, String)) As DataTable

    ''' <summary>
    ''' 添加报废信息到报工表
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function UpDateLossQtyInfo(ByVal para As Dictionary(Of String, String)) As Boolean

    ''' <summary>
    ''' 获取员工派工的最大优先级
    ''' </summary>
    ''' <param name="workerID"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetMaxPriorityCode(ByVal workerID As String) As Int32

    ''' <summary>
    ''' 获取工厂报工是否选择检验员
    ''' </summary>
    ''' <param name="Factoryid"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetUserAttribute_SelectChecker(ByVal Factoryid As String) As String

    ''' <summary>
    ''' 获取历史报工信息
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetHistoryStepWorkReport(ByVal para As Dictionary(Of String, String)) As DataTable

    ''' <summary>
    ''' 获取撤销报工流水卡信息
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetWorkReportCancelInfo(ByVal para As Dictionary(Of String, String), ByRef sbCondition As String) As uMESProcessResult

    ''' <summary>
    ''' 获取报工撤销单件单卡批次信息 create by tianFW 2018年11月21日
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetCancleWorkReportDetailInfo(ByVal para As Dictionary(Of String, String)) As DataTable

    ''' <summary>
    ''' 根据选择的批次获取已经报工未检验的报工记录 create tianFW 2017年12月6日
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetNoCheckWorkReportInfo(ByVal para As Dictionary(Of String, String))

    ''' <summary>
    ''' 获取装试员工报工批次信息
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetZSWorkReportContainerInfo(ByVal para As Dictionary(Of String, String), Optional ByVal isZs As Boolean = False) As DataTable

    ''' <summary>
    ''' 获取员工没有报工的批次工艺下的工序
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetWorkerNotReportWorkflowstepInfo(ByVal para As Dictionary(Of String, String), Optional ByVal isZS As Boolean = False) As DataTable

    ''' <summary>
    ''' 获取上一序的报工信息 
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetLastWorkflowStepWorkReportInfo(ByVal containerid As String) As DataTable

    ''' <summary>
    ''' 获取批次当前序是否存在测试检验
    ''' </summary>
    ''' <param name="containerid"></param>
    ''' <param name="workflowstepid"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetContainerCurrentIsReportType_3(ByVal containerid As String, ByVal workflowstepid As String) As Integer

    ''' <summary>
    ''' 通过派工记录获取点击报工时的派工记录对应的报工数量 create by tianFW 2018年5月24日
    ''' </summary>
    ''' <param name="ContainerStepDispatchInfoIDs">派工IDs</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetWorkReportTimeReallyDisReportNum(ByVal ContainerStepDispatchInfoIDs As String) As DataTable

    ''' <summary>
    ''' 添加工人设备状态信息 create by tianFW 2018年7月19日
    ''' </summary>
    ''' <param name="dt"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function AddWorkResourceStatusInfo(ByVal dt As DataTable) As Boolean

    ''' <summary>
    ''' 获取批次工序试验件报工 create by tianFW 2018年12月19日
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function ExistSJWorkReport(ByVal para As Dictionary(Of String, String)) As DataTable

    ''' <summary>
    ''' 更新批次首检或工序检状态标识 add bytianFW 2019年1月3日
    ''' </summary>
    ''' <param name="containerIDs">批次ID</param>
    ''' <param name="Type">1 首检 2 工序检</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function UpdateStepCheckNum(ByVal containerIDs As String, ByVal Type As Integer) As Boolean

    Function FillUpdateStepCheckNum(ByVal containerIDs As String, ByVal Type As Integer) As Object()
    ''' <summary>
    ''' 更新批次当前序的报工总数
    ''' </summary>
    ''' <param name="containerIDs">批次IDs</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function UpdateWorkReportNum(ByVal containerIDs As String) As Boolean

#Region "报工装配处理"

    ''' <summary>
    ''' 获取工艺中已经派工的工序，已备装配
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetStepInfoList(ByVal para As Dictionary(Of String, String), Optional ByVal isZs As Boolean = False) As DataTable

    ''' <summary>
    ''' 获取任务单号
    ''' </summary>
    ''' <param name="cid"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetTogetherFlag(ByVal cid As String) As String

    ''' <summary>
    ''' 获取任务单发料确认信息
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetIssueConfirmData(ByVal para As Dictionary(Of String, String)) As DataTable

    ''' <summary>
    ''' 插入WorkReportMaterialRecord
    ''' </summary>
    ''' <param name="entity"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function AddWorkReportMaterialRecord(ByVal entity As ContainerStepWorkReportDTO) As Boolean

    ''' <summary>
    ''' 获取工序/工步本次确认中已经装入数量
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetHasIssueQty(ByVal para As Dictionary(Of String, String)) As String

    ''' <summary>
    ''' 获取并展示已经装配的资料
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetWorkreportmaterialrecord(ByVal para As Dictionary(Of String, String)) As DataSet

    ''' <summary>
    ''' 删除装配记录
    ''' </summary>
    ''' <param name="strid"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function DelWorkreportmaterialrecord(ByVal strid As String) As Boolean

    ''' <summary>
    ''' 获取待分解装配记录
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetWRSplitmaterialrecord(ByVal para As Dictionary(Of String, String)) As uMESProcessResult

    ''' <summary>
    ''' 报工分解记录保存
    ''' </summary>
    ''' <param name="entity"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function AddSplitReportMaterialRecord(ByVal entity As ContainerStepWorkReportDTO) As Boolean

    ''' <summary>
    ''' 根据批次获取产品信息
    ''' </summary>
    ''' <param name="cid"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetProductInfobyCid(ByVal cid As String) As DataTable
    ''' <summary>
    ''' 更新装配--件号为完工状态
    ''' </summary>
    ''' <param name="entity"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function UpdateWorkreportmaterialrecord(ByVal entity As ContainerStepWorkReportDTO) As Boolean
    ''' <summary>
    ''' 查询-装配记录--已装完
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetWorkreportmaterialrecordStatus(ByVal para As Dictionary(Of String, String)) As DataTable
    ''' <summary>
    ''' 获取已经分解的记录
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetContainerSplitData(ByVal para As Dictionary(Of String, String)) As uMESProcessResult

    ''' <summary>
    ''' 获取分解及入库申请后的零组件状态
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetSplitProductBatchnoData(ByVal para As Dictionary(Of String, String)) As DataTable

    ''' <summary>
    ''' 入库申请插入
    ''' </summary>
    ''' <param name="entity"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function AddSplitMaterialInStoreRecord(ByVal entity As ContainerStepWorkReportDTO) As Boolean

    ''' <summary>
    ''' 入库及出库更新资料
    ''' </summary>
    ''' <param name="entity"></param>
    ''' <param name="flag"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function UpdateSplitMaterialInStoreRecord(ByVal entity As ContainerStepWorkReportDTO, ByVal flag As String) As Boolean
#End Region

    ''' <summary>
    ''' 获取装配整合信息 create tianFW 2018年5月9日
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetIssueMaterialIntegratedData(ByVal para As Dictionary(Of String, String))

    ''' <summary>
    ''' 装试大阶段报工 create tianFW 2018年5月4日
    ''' </summary>
    ''' <param name="enginepartplanID" >分解计划唯一ID</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function BigStageWorkReport(ByVal enginepartplanID As String) As Boolean

    ''' <summary>
    ''' 判断本大阶段的前面大阶段是否完工
    ''' </summary>
    ''' <param name="mfgid"></param>
    ''' <param name="strSequence"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function CheckPreStepComplete(ByVal mfgid As String, ByVal strSequence As String) As DataTable

    Function FillUpdateLossQtyInfo(ByVal para As Dictionary(Of String, String)) As Object()

    Function UpdateStepCheckPointReportId(ByVal dto As ContainerStepWorkReportDTO) As String
    ''' <summary>
    ''' 获取新报工数据
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetNewStepWorkReportList(ByVal para As Dictionary(Of String, String)) As uMESProcessResult
    ''' <summary>
    ''' 验证是否存在报工
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function IsExistWorkReported(ByVal para As Dictionary(Of String, String)) As Boolean
    ''' <summary>
    ''' 获取批次的派工记录（具体到工厂，工人）
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetNewStepWorkReportByContainer(ByVal para As Dictionary(Of String, String)) As DataTable
    ''' <summary>
    ''' 获取工步报工信息
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetStepInfoReportList(ByVal para As Dictionary(Of String, String)) As uMESProcessResult
    ''' <summary>
    ''' 填充工步报工数据
    ''' </summary>
    ''' <param name="entity"></param>
    ''' <param name="value"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function FillContainerStepInfoWorkReportDataTrans(ByVal entity As ContainerStepWorkReportDTO, ByVal value As String) As Object()
    ''' <summary>
    ''' 填充工步派工表接收人
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function FillReceviceDispatch2(ByVal para As Dictionary(Of String, String)) As Object()
    ''' <summary>
    ''' 更新工人可能录入的检测项(工步)
    ''' </summary>
    ''' <param name="dto"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function UpdateStepInfoCheckPointReport(ByVal dto As ContainerStepWorkReportDTO) As Object()
    ''' <summary>
    ''' 插入明细表(工步)
    ''' </summary>
    ''' <param name="entity"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function FillContainerStepInfoWorkReportChild2(ByVal entity As ContainerStepWorkReportChildDTO) As Object()
    ''' <summary>
    ''' 获取单件单卡批次的工步数据
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetSingleContainerStepInfoReportList(ByVal para As DataRow) As DataTable
    ''' <summary>
    ''' 获取工步未报工子序号
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetContainerStepInfoNoReportChildList(ByVal para As Dictionary(Of String, String)) As DataTable
    ''' <summary>
    ''' 获取可撤销的工步报工 add by zhangrj 2022-09-21
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetStepInfoDeletableReportInfo(ByVal para As Dictionary(Of String, String)) As uMESProcessResult
    ''' <summary>
    ''' 撤销工步报工 add by zhangrj 2022-09-21
    ''' </summary>
    ''' <param name="containerStepWorkReportIDs"></param>
    ''' <param name="list"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function DelContainerStepInfoReport2ByID(ByVal containerStepWorkReportIDs As String, ByVal list As List(Of Dictionary(Of String, String)), ByRef msg As String) As Boolean
    ''' <summary>
    ''' 获取批量报工工步列表 add by zhangrj 2022-10-12
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetStepInfoBatchReportList(ByVal para As Dictionary(Of String, String)) As uMESProcessResult
    ''' <summary>
    ''' 撤销工步报工（通过工序）add by zhangrj 2023-3-7
    ''' </summary>
    ''' <param name="list"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function DelContainerStepInfoReport2BySpec(ByVal list As List(Of Dictionary(Of String, String))) As Boolean

    ''' <summary>
    ''' 获取总体某本工艺的标准工时yuxj20230414
    ''' </summary>
    ''' <param name="workflowid"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetZSWorkflowWorkTime(ByVal workflowid) As DataTable

    ''' <summary>
    ''' 工步报工前验证是否存在无效的派工 add by zhangrj 2023-04-20
    ''' </summary>
    ''' <param name="sqlStr"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function IsVaildDispatchForStepInfoWorkReport(ByVal sqlStr As String) As Boolean

    ''' <summary>
    ''' 验证自检自分报工条件，专检序是否已经首件检验
    ''' </summary>
    ''' <param name="dt"></param>
    ''' <param name="isFirstCheck"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function IsValidSelfCheckReport(ByVal dt As DataTable, ByVal isFirstCheck As Boolean) As Boolean
    ''' <summary>
    ''' 保存自检自分报工数据
    ''' </summary>
    ''' <param name="para"></param>
    ''' <remarks></remarks>
    Sub SaveSelfCheckReportData(ByVal para As List(Of Dictionary(Of String, String)), ByVal m_UserInfo As CurrentUserInfo)

    ''' <summary>
    ''' 获取工步报工信息（热表）
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetRBStepInfoReportList(ByVal para As Dictionary(Of String, String)) As uMESProcessResult
    ''' <summary>
    ''' 基于工步排产
    ''' 获取批量报工工步列表（热表） add by zhangrj 2024-9-10
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetApsStepInfoBatchReportList(ByVal para As Dictionary(Of String, String)) As uMESProcessResult
    ''' <summary>
    ''' 验证特殊过程工序（领工\报工时验证）add by zhangrj 20250331
    ''' </summary>
    ''' <param name="dtDatas">需要验证的数据源</param>
    ''' <param name="userInfo">操作人员</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function ValidSpecialCourseSpecReportByReport(ByVal dtDatas As DataTable, ByVal userInfo As CurrentUserInfo) As SpecialReportValidDTO
    ''' <summary>
    ''' 验证三定卡片工序（验证主方法，入口）add by zhangrj 20251011
    ''' </summary>
    ''' <param name="dtDatas">需要验证的数据源</param>
    ''' <param name="userInfo">操作人员</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function ValidSpecThreeFixedCardByReport(ByVal dtDatas As DataTable, ByVal userInfo As CurrentUserInfo) As Tuple(Of Boolean, String)
    ''' <summary>
    ''' 领工时验证工序的排产是否在未来两天内的计划时间
    ''' </summary>
    ''' <param name="dtDatas"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function IsApsOverTimeByReport(ByVal dtDatas As DataTable) As Tuple(Of Boolean, String)

End Interface

